package me.xue.communityhealth.repo;

import me.xue.communityhealth.model.InformationType;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface InformationTypeRepository {

    @Insert("INSERT INTO `information_type`(type) VALUES(#{type})")
    int save(InformationType informationType);

    @Delete("DELETE FROM `information_type` WHERE `id`=#{id}")
    int delete(Integer id);

    @Update("UPDATE `information_type` SET `type`=#{type} WHERE `id`=#{id}")
    int update(InformationType informationType);

    @Select("SELECT * FROM `information_type` WHERE `id`=#{id}")
    InformationType findOne(Integer id);

    @Select("SELECT * FROM `information_type`")
    List<InformationType> findAll();

}
